import request from '@/utils/request';
import type {categoryResponseData} from './model/attr';
enum API {
    C1 = "/admin/product/getCategory1",
    //二级分类的接口地址
    C2 = "/admin/product/getCategory2/",
    //三级分类的接口地址
    C3 = "/admin/product/getCategory3/",
    ATTR="/admin/product/attrInfoList/",
      //添加属性|修改属性
      ADDORUPDATEATTR='/admin/product/saveAttrInfo',
      //删除属性
    DELETEATTR="/admin/product/deleteAttr/"
}
export const reqC1List = () => request.get(API.C1);
export const reqC2List = (category1Id: number | string) => request.get<any, categoryResponseData>(API.C2 + category1Id);
export const reqC3List = (category2Id: number | string) => request.get<any, categoryResponseData>(API.C3 + category2Id);
//获取某一个三级分类下平台属性[属性值]
export const reqAttrList = (category1Id:number|string,category2Id:number|string,category3Id:number|string)=>request.get(API.ATTR+`${category1Id}/${category2Id}/${category3Id}`);
export const reqAddOrUpdateAttr=(data:any)=>request.post(API.ADDORUPDATEATTR,data);
export const reqDeleteAttr = (attrId:number)=>request.delete<any,any>(API.DELETEATTR+attrId);